#include<bits/stdc++.h>
using namespace std;
const int N = 5e4 + 90;
const int D = 60;
struct ACAM{
    int to[N][10];
    int fail[N];
    bool flg[N];
    int pcnt;
    int rot;
    int gen(){
        int now = ++pcnt;
        memset(to[now],0,sizeof(to[now]));
        fail[now] = 0;
        return now;
    }
    void init(){
        rot = gen();
    }
    void insert(string s){
        int now = rot;
        for(char c : s){
            c -= '0';
            if(!to[now][c]){
                to[now][c] = gen();
            }
            now = to[now][c];
        }
        flg[now] = 1;
    }
    void build(){
        queue<int> que;
        for(int i = 0;i < 10;i++){
            if(to[rot][i]){
                que.push(to[rot][i]);
                fail[to[rot][i]] = rot; 
            }else{
                to[rot][i] = rot;
            }
        }
        while(que.size()){
            int now = que.front();
            que.pop();
            for(int i = 0;i < 10;i++){
                if(to[now][i]){
                    que.push(to[now][i]);
                    fail[to[now][i]] = to[fail[now]][i];
                }else{
                    to[now][i] = to[fail[now]][i];
                }
            }
        }
    }
}acam;
const int MOD = 1e9+7;
int dp0[D][N][2];
int dp1[D][2];
pair<int,int> solve(string x,int d){
    memset(dp0,0,sizeof(dp0));
    memset(dp1,0,sizeof(dp1));
    dp0[0][1][1] = 1;
    for(int i = 1;i <= d;i++){
        for(int s = 1;s <= acam.pcnt;s++){
            if(acam.flg[s])continue;
            for(int j = 0;j <= 9;j++){
                int cur = acam.to[s][j];
                if(acam.flg[cur]){
                    dp1[i][0] = (dp1[i][0] + dp0[i - 1][s][0])%MOD;
                }else{
                    dp0[i][cur][0] = (dp0[i][cur][0] + dp0[i - 1][s][0])%MOD;
                }
            }
            for(int j = 0;j < x[i - 1] - '0';j++){
                int cur = acam.to[s][j];
                if(acam.flg[cur]){
                    dp1[i][0] = (dp1[i][0] + dp0[i - 1][s][1]);
                }else{
                    dp0[i][cur][0] = (dp0[i][cur][0] + dp0[i - 1][s][1])%MOD;
                }
            }
            int cur1 = acam.to[s][x[i - 1] - '0'];
            if(acam.flg[cur1]){
                dp1[i][1] = (dp1[i][1] + dp0[i - 1][s][1])%MOD;
            }else{
                dp0[i][cur1][1] = (dp0[i][cur1][1] + dp0[i - 1][s][1])%MOD;
            }
        }
        dp1[i][0] = (dp1[i][0] + 1ll*dp1[i - 1][0]*10%MOD + 1ll*dp1[i - 1][1]*(x[i - 1] - '0')%MOD)%MOD;
        dp1[i][1] = (dp1[i][1] + dp1[i - 1][1])%MOD;
    }
    return make_pair(dp1[d][0],dp1[d][1]);
}
int main(){
    string s;
    cin>>s;
    string x,y;
    cin>>x>>y;
    if(s.size() < x.size()/2){
        cout<<0<<'\n';
        return 0;
    }
    acam.init();
    for(int i = 0;i <= s.size() - x.size()/2;i++){
        string ne = s.substr(i,x.size()/2);
        acam.insert(ne);
        //cerr<<ne<<'\n';
    }
    acam.build();
    pair<int,int> r1 = solve(x,x.size()),r2 = solve(y,y.size());
    cout<<(r2.first + r2.second - r1.first + MOD)%MOD<<'\n';
}